package com.haidong.service.impl;

import com.haidong.dao.LogDao;
import com.haidong.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private LogDao logDao;

    @Override
    // 修改事务的传播行为:设置为当前操作需要新事务(这样不管该事务是否回滚都会执行新事务),一般用默认值
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public void log(String out, String in, Double money) {
        logDao.log(out + "给" + in + "转账" + money + "元.");
    }
}
